package GameHallDeskModel;

public class HallDeskModel {

	private static HallDeskModel hall=new HallDeskModel();
	private int players;
	private int playerA;
	private int playerB;
	private int room;
	private int desk;
	
	public HallDeskModel(){
		
		players=0;
		
	}
	
	public static HallDeskModel getInstance(){
		
		return hall;
	}
	
	public void addPlayer(int id){
		
		if(players==0){
			players++;
			playerA=id;
		}else if(players==1&&playerA!=id&&playerB!=id){
			players++;
			playerB=id;
		}
	}
	
	public void eliminatePlayer(int id,int turn){
		
		switch(turn){
		
		case 1:
			if(playerA==id){
				playerA=playerB;
                                playerB=0;
				players--;
			}
			break;
			
		case 2:
			if(playerB==id){
				playerB=0;
				players--;
			}
			break;
			
			default:
				break;
		}
	}
	
	public void exchangePlayers(){
		
		int temp=playerA;
		playerA=playerB;
		playerB=temp;
		
	}
	
	public void setRoom(int room){
		
		this.room=room;
	}
	
	public void setDesk(int desk){
		
		this.desk=desk;
	}
		
	public void setPlayerA(int id){
		
		playerA=id;
	}
	
	public void setPlayerB(int id){
		
		playerB=id;
	}
	
	public void setPlayers(int id){
		
		players=id;
	}
	
	public int getPlayers(){
		
		return players;
	}
	
	public int getRoom(){
		
		return room;
	}
	
	public int getDesk(){
		
		return desk;
	}
	
	public int getPlayerA(){
		
		return playerA;
	}
	
	public int getPlayerB(){
		
		return playerB;
	}
	
}
